package com.letoy.edu.controller;

import com.letoy.edu.entity.CourseSchedule;
import com.letoy.edu.service.ScheduleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@Api(value = "课程时间管理", tags = "课程时间API")
public class ScheduleController {


    @Autowired
    ScheduleService scheduleService;

    @PostMapping("/course/findAllSchedule")
    @ApiOperation(value = "课程时间表查询所有", notes = "课程时间表表查询所有")
    @ApiImplicitParam(value = "", name = "Authorization", paramType = "header", dataType = "String", required = true)
    private Map<String, Object> findAllSchedule() {
        return scheduleService.findAllSchedule();
    }

    @PostMapping("/course/updateSchedule")
    @ApiOperation(value = "课程时间表更新所有", notes = "课程时间表表更新所有")
    @ApiImplicitParam(value = "", name = "Authorization", paramType = "header", dataType = "String", required = true)
    private Map<String, Object> updateScheduleByClassNumber(@RequestBody CourseSchedule courseSchedule) {

        return scheduleService.updateScheduleByClassNumber(courseSchedule);
    }
}
